#!/bin/bash
set -eo pipefail
cd /opt/export/

runday="{{ execution_date | cst_ds }}"


hdfs dfs -get -f /report/出港转运留仓/出港转运留仓_$runday   /opt/export/出港转运留仓_$runday



zip /opt/export/出港转运留仓_$runday.zip  /opt/export/出港转运留仓_$runday/留仓明细/* /opt/export/出港转运留仓_$runday/留仓汇总/*


/usr/local/python3/bin/python3  /usr/local/airflow/dags/utils/operators/upload_oss.py  出港转运留仓/出港转运留仓_$runday.zip  /opt/export/出港转运留仓_$runday.zip

data_size=$(ls -lh 出港转运留仓_$runday.zip | awk '{print $5}')
Message="出港转运留仓_$runday 报表上传成功 大小: $data_size"

curl 'https://oapi.dingtalk.com/robot/send?access_token=816a8f35fd84432ffa6bff9d7714abc322628bb4a8ded86908550d2335aba613' \
   -H 'Content-Type: application/json' \
   -d "
  {\"msgtype\": \"text\",
    \"text\": {
        \"content\": \"监控内容:$Message\"
     }
  }" || true


rm -rf /opt/export/出港转运留仓_$runday
rm -rf /opt/export/出港转运留仓_$runday.zip